﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using CollegeShop.Biz;
using CollegeShop.WebProcessor;
using CollegeShop.Infrastructure.Entities.Enum;

namespace CollegeShop.Web.Controllers
{
    [Auth(SystemRole.Director,SystemRole.Staff)]
    public class StaffController : Controller
    {
        //
        // GET: /Staff/

        public ActionResult Index()
        {
            ViewBag.ManagerTitle = UserBiz.GetStaffInfo(HttpContext.User.Identity.Name);
            ViewBag.PendingOrder = CommodityBiz.GetPendingOrders(HttpContext.User.Identity.Name);
            return View();
        }

        public ActionResult Orders()
        {
            ViewBag.ManagerTitle = UserBiz.GetStaffInfo(HttpContext.User.Identity.Name);
            ViewBag.Orders = CommodityBiz.GetOrders(HttpContext.User.Identity.Name);
            ViewBag.MonthAmount = CommodityBiz.GetSalesAmount(HttpContext.User.Identity.Name, true);
            ViewBag.SalesAmount = CommodityBiz.GetSalesAmount(HttpContext.User.Identity.Name, false);
            return View();
        }
        public ActionResult Report(int category=0, int timespan=0, int state = 0, int page =0)
        {
            ViewBag.Page = page;
            ViewBag.ManagerTitle = UserBiz.GetStaffInfo(HttpContext.User.Identity.Name);
            ViewBag.SalesItems = CommodityBiz.GetSalesItem(HttpContext.User.Identity.Name, category,timespan,state, page, 15);
            ViewBag.MonthAmount = CommodityBiz.GetSalesAmount(HttpContext.User.Identity.Name, true);
            ViewBag.SalesAmount = CommodityBiz.GetSalesAmount(HttpContext.User.Identity.Name, false);
            return View();
        }
    }
}
